<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

	<ui:composition template="/templates/common.xhtml">

		<ui:define name="pageTitle">Detalhe Pessoa</ui:define>

		<ui:define name="pageHeader">Pessoa</ui:define>

		<ui:define name="body">
			
			<h:messages errorStyle="color: red" infoStyle="color: green" layout="table" />
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputText value="Nome*:"/>
                    <h:inputText label="Nome" value="#{personDetailController.person.name}" title="Nome" maxlength="50" required="true" requiredMessage="Nome: Campo Obrigatório"/>                    
                    <h:outputText value="Data de Nascimento*:"/>
                    <h:inputText id="datanascimento" label="Data Nascimento" value="#{personDetailController.person.birthDate}" title="Data" required="true" maxlength="10" 
                                     requiredMessage="Data Nascimento: Campo Obrigatório"
                                     converterMessage="Data Nascimento deve ter o formato dd/mm/aaaa" 
                                     validator="#{personDetailController.validateBirthDate}">
              						<f:convertDateTime type="date" dateStyle="" pattern="dd/MM/yyyy" />  
 					</h:inputText>
               </h:panelGrid>
               <p><b>Experiências</b></p>
               <ui:repeat value="#{personDetailController.person.personExperiences}" var="personExperience" varStatus="loop">
               		Empresa*: <h:inputText value="#{personExperience.enterpriseName}" maxlength="50" required="true" requiredMessage="Empresa: Campo Obrigatório"/>&nbsp;
               		<h:commandButton action="#{personDetailController.deleteExperience}" value="Excluir Experiencia" image="/images/remove.png" /><br/>
               </ui:repeat>
               <br/><br/><br/>

               <h:commandButton action="#{personDetailController.newExperience}" value="Nova Experiencia" /><br/><br/>
               <h:commandButton action="#{personDetailController.edit}" value="Salvar" /><br/>
               <br/><br/><br/>
               <h:commandButton value="Voltar" action="person_list" immediate="true" />
	        </h:form>
                    
		</ui:define>
	</ui:composition>
</html>